home *** CD-ROM | disk | FTP | other *** search
- Path: news.interport.net!usenet
- From: yaron@interport.net (Adi)
- Newsgroups: comp.lang.c++
- Subject: Re: Default Class Initialisation Question...
- Date: Mon, 25 Mar 1996 07:29:59 GMT
- Organization: Interport Communications Corp.
- Message-ID: <4j57mv$6ps@park.interport.net>
- References: <00001a81+0000af6f@msn.com>
- NNTP-Posting-Host: yaron.port.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- Tony_Bateman@msn.com (Tony Bateman) wrote:
-
- >I have a problem concerning default initialisation of classes.
-
- >If I define a class Rectangle, and have default initialisation values
- >in the constructor defined thus:
-
- >Rectangle::Rectangle(USHORT width=0, USHORT height=0):
- >itsWidth(width),
- >itsHeight(height)
- >{}
-
- >then I can define a rectangle to have a width = 30 and height = 0 by
- >omitting one of the variables in the initialisation:
-
- >Rectangle myRectangle(30);
-
- >Fine. But what if I want to leave the width a default value of 0 and
- >set the height to 30. How could I do it? Can it be done in C++ in a
- >straightforward manner? Is there anything like a default placeholder
- >that can be used?
-
- > Regards,
- > Tony Bateman.
-
- >-----------------------------------------------------------------------------
- >I live in Finland - second highest suicide rate per head of
- >population in the world.
- >It's the beginning of spring - most common time for suicides.
- >Computer programmering is a recognised high risk suicide profession.
- >Do NOT spill my pint.....
- >-----------------------------------------------------------------------------
- >
-
- Just forget about it. There is no such thing in the C++ syntax.
- Annoying, ahha...
-
- Adi Degani
- New-York, NY
-
-
-